﻿<%
	Object failedObj = request.getAttribute("failed");
	String failed = "successful";
	if (failedObj != null){
	    failed= failedObj.toString();
	}
	int errorType;
	if (failed.equals("successful")) {
	    errorType = 0;
	}else if (failed.equals("org.apache.shiro.authc.IncorrectCredentialsException")){
	    errorType = 1;
	}else if (failed.equals("org.apache.shiro.authc.UnknownAccountException")){
	    errorType = 2;
	}else{
	    errorType = 3;
	}
%>
<!DOCTYPE html>
<html>
   <head>
   <title>ipt</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <meta name="description" content="">
   <meta name="author" content="hongchun.li">
   <link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
   <link  href="themes/css/basic.css" type="text/css" rel="stylesheet"/>
   <link  href="themes/css/login.css" type="text/css" rel="stylesheet"/>
   <script type="text/javascript" src="javascript/jquery-1.7.2.min.js"></script>
 </head>
 <body>
 	<div id="main" class="fn-br">
 		<form class="form-default" method="post" action="login.jsp">
 			<p><label for="apis_username" >用户名:</label><input type="text" id="apis_username" name="apis_username"/></p>
 			<p><label for="apis_password" >密码:</label><input type="password" id="apis_password" name="apis_password"/></p>
 			<p><label></label><input class="btn" type="submit" value="LOGIN"/></p>
 		</form>
 	</div>
 	 <div id="msgbox" class="msgbox-error" style="display : none; width:400px;margin:0px auto;">
				<i class="msgbox-icon"></i>
				<div class="msgbox-main">
					<div class="msgbox-header">提示</div>
					<div class="msgbox-content"></div>
				</div>
	  </div>
	  <script>
		 (function(){
			 switch(<%=errorType%>){
			 	case 0:
					 break;
			 	case 1:
				 	$("#msgbox").find(".msgbox-content").html("密码错误，请重试");
				 	$("#msgbox").show();
					 break;
			 	case 2:
				 	$("#msgbox").find(".msgbox-content").html("该用户不存在!");
				 	$("#msgbox").show();
					 break;
			 	case 3:
				 	$("#msgbox").find(".msgbox-content").html("用户名或密码错误，请重试!");
				 	$("#msgbox").show();
					 break;
				 default :
				 break; 
			 }
		 })();
	  </script>
 </body>
</html>